<?php
include "./googleAuthenticator.php";
$ga = new \PHPGangsta_GoogleAuthenticator();
$type = $_GET['type'] ?? 'code';
switch($type){
    case 'code':
        $secret = $ga->createSecret();
        $qrCodeUrl = $ga->getQRCodeGoogleUrl('luokakale', $secret, 'googleVerify');
        echo $secret.'<br />';//3GWYV5AITNDC47XW
        echo $qrCodeUrl;
        break;
    case 'ver':
        if(isset($_GET['code'])){
            $checkResult = $ga->verifyCode('3GWYV5AITNDC47XW', $_GET['code'], 0);
            var_dump($checkResult);
        }
        break;
    default:
}
